package com.jinrustar.httpfileserver.springboot.service.impl;

//import com.baomidou.framework.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jinrustar.httpfileserver.springboot.entity.UsCurrentVersion;
import com.jinrustar.httpfileserver.springboot.mapper.UsCurrentVersionMapper;
import com.jinrustar.httpfileserver.springboot.service.IUsCurrentVersionService;
import org.springframework.stereotype.Service;

import java.util.Map;


/**
 * <p>
 * 歌曲  服务实现类
 * </p>
 *
 * @author LiDuanWei
 * @since 2017-09-29
 */
@Service
public class UsCurrentVersionServiceImpl extends ServiceImpl<UsCurrentVersionMapper, UsCurrentVersion> implements IUsCurrentVersionService {


    @Override
    public Page<UsCurrentVersion> queryAll(Map params) {
        int pageNum = Integer.parseInt(params.getOrDefault("pageNum", "1").toString());
        int pageSize = Integer.parseInt(params.getOrDefault("pageSize", "10").toString());
        Page page = new Page<UsCurrentVersion>(pageNum, pageSize);
        page.setRecords(baseMapper.selectCurrentVersionList(page, params));
        return page;
    }

    @Override
    public boolean insertOrUpdateWithDefaultValue(UsCurrentVersion usCurrentVersion) {
        ServiceUtil.fillDefaultValue(usCurrentVersion);
        return insertOrUpdate(usCurrentVersion);
    }


}
